<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let i = 1
    while (i < 5) {
      console.log(i)
      i++
    }

    for (let i = 0; i < 5; i++) {
      console.log(i)
    }


    // 1. 数组
    let names = ['小红', '小明', '小强']

    for (let i = 0; i < names.length; i++) {
      console.log(names[i])
    }

    // 2. 对象
    let person1 = { name: '小红', age: 18, gender: 'woman' }

    for (let key in person1) {
      // key 为属性值
      // console.log(key)
      console.log(person1[key])
    }

    // 3. 对象数组
    let students = [
      { name: '小红', age: 18, gender: 'woman' },
      { name: '小明', age: 19, gender: 'man' },
      { name: '小强', age: 18, gender: 'woman' }
    ]

    for (let i = 0; i < students.length; i++) {
      console.log(students[i].name)
    }
  </script>
</body>

</html>